<%@include file="/common/CHeader.jsp" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%>
<!doctype html>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


    </style>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
</head>
<body>
<form class="form-inline definewidth m20" action="addxmldoc" method="post" style="margin-bottom: 10px">
    文档类型：
    <input type="text" name="doctype" class="form-control">&nbsp;&nbsp;
    文档名称：
    <input type="text" name="docname" class="form-control" placeholder="" value="">&nbsp;&nbsp;
    数据集ID：
    <select name="datasetid" class="form-control">
        <c:forEach items="${olapDatasetList}" var="u">
            <option value="${u.datasetid}">${u.datasetid}</option>
        </c:forEach>
    </select>
    是否有效：
    <select name="active" class="form-control">
        <option value="Y">有效</option>
        <option value="N">无效</option>
    </select>&nbsp;&nbsp;
    <input type="submit" class="btn btn-primary"  value="新增"/>
</form>
<table class="table table-bordered table-hover definewidth m10">
    <thead>
    <tr>
        <th>文档ID</th>
        <th>文档类型</th>
        <th>文档名称</th>
        <th>数据集ID</th>
        <th>是否有效</th>
        <th>操作</th>
    </tr>
    </thead>

    <c:forEach items="${modelAndPage.model}" var="t">
        <tr>
            <td>${t.docid}</td>
            <td>${t.doctype}</td>
            <td>${t.docname}</td>
            <td>${t.datasetid}</td>
            <td>${t.active}</td>
            <td>
                <a href="<%=basePath %>olapxmlnode/selectlist?docid=${t.docid}">查看</a>&nbsp;&nbsp;<a href="<%=basePath %>olapxmldoc/findByid?docid=${t.docid}">编辑</a>&nbsp;&nbsp;<a href="<%=basePath %>olapxmldoc/deleteXmldoc?docid=${t.docid}">删除</a>
            </td>
        </tr>
    </c:forEach>
</table>
<div class="inline pull-right page">
    <c:set var="page" value="${modelAndPage.page}"></c:set>
    ${page.getCount()} 条记录&nbsp; ${page.getCurrent()}/${page.getTotal()} 页&nbsp;
    <c:if test="${page.getCurrent()>1}">
        <a href="?begin=${(page.getCurrent()-2)*page.length}">上一页</a>&nbsp;
    </c:if>
    <c:set var="endPage" value="false"/>
    <c:forEach begin="0" step="1" end="${page.getTotal()-1}" var="everyPage">
        <c:choose>
            <c:when test="${everyPage+1 >5}">
                <c:if test="${endPage=='false'}">
                    <c:set var="endPage" value="true"/>
                </c:if>
            </c:when>
            <%--<c:otherwise>--%>
            <%--<a href="?begin=${everyPage*page.length}">${everyPage+1}</a>--%>
            <%--</c:otherwise>--%>
        </c:choose>
    </c:forEach>

    <c:if test="${page.getCurrent()<page.getTotal()}">
        <a href="?begin=${(page.getCurrent())*page.length}">下一页</a>
    </c:if>
</div>
</body>
</html>